A data processing device may include one or more processing cores, and those cores may be used to support multithreading and/or multiprocessing. In recent years, processors with many cores have entered mainstream deployment. Terms like many-core and manycore have been coined to denote processors with a dozen or more cores, such as the processors distributed by Intel Corporation under the INTEL XEON PHI trademark, for instance.
The capabilities provided by processors with many cores can increase the importance of multithreading and multiprocessing. In particular, it can be important for software to be able to effectively and efficiently control processor affinity settings for execution entities like threads and processes. It can also be important for software to be able to effectively and efficiently control affinity settings for other resources, such as memory and input/output (I/O) resources. The affinity settings may also be referred to as the affinity mask.
In a conventional processing device, when the currently executing thread of an application (the parent thread) creates or instantiates a new thread (a child thread), the child thread automatically inherits the processor, memory, and I/O affinity settings of the parent thread. However, this behavior can create challenges, particularly when (a) different affinity settings would be more appropriate for the child thread and (b) the original affinity settings of the parent thread should be preserved during and after instantiation of the child thread.